package com.example.scaffold.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.scaffold.order.entity.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 订单Mapper接口
 * 遵循阿里手册：DAO层命名规范，避免使用SELECT *查询
 *
 * @author example
 */
// @Mapper
public interface OrderMapper extends BaseMapper<Order> {

    /**
     * 根据用户名查询订单
     * 遵循阿里手册：参数绑定使用@Param注解
     *
     * @param username 用户名
     * @return 订单信息
     */
    @Select("select * from sys_order WHERE username = #{username}")
    Order selectByUsername(@Param("username") String username);
}